package br.com.project;

import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.Menu;
import android.support.v4.view.MenuItem;
import android.widget.Toast;

public class TemplateActivity extends FragmentActivity {

	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		
//        LinearLayout linear = new LinearLayout(this);
//        linear.setOrientation(LinearLayout.VERTICAL);
//        linear.setId(1000);
//
//        TextView text = new TextView(this);
//        text.setText("hallo hallo");
//        text.setBackgroundColor(R.color.soft_grey);
//        text.setPadding(5, 5, 5, 5);
//        text.setLayoutParams(new LayoutParams(
//                LayoutParams.FILL_PARENT,
//                LayoutParams.WRAP_CONTENT));
//
//        linear.addView(text);
//        setContentView(linear);

	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		getMenuInflater().inflate(R.menu.main_menu, menu);
		return super.onCreateOptionsMenu(menu);
	}

	@Override
	public boolean onOptionsItemSelected(MenuItem item) {
		switch (item.getItemId()) {
		case android.R.id.home:
			// TODO handle clicking the app icon/logo
			return false;
		case R.id.menu_refresh:
			Toast.makeText(this, "Refresh", Toast.LENGTH_SHORT);
			return true;
		case R.id.menu_close:
			Toast.makeText(this, "Close", Toast.LENGTH_SHORT);
			return true;
//		case R.id.menu_compose:
//			Toast.makeText(this, "Compose", Toast.LENGTH_SHORT);
//			return true;
		case R.id.menu_search:
			Toast.makeText(this, "Search", Toast.LENGTH_SHORT);
			return true;
		case R.id.menu_bak_none:
			Toast.makeText(this, "NONE", Toast.LENGTH_SHORT);
			item.setChecked(true);
			getSupportActionBar().setBackgroundDrawable(null);
			return true;
		case R.id.menu_bak_gradient:
			item.setChecked(true);
			getSupportActionBar().setBackgroundDrawable(
					getResources().getDrawable(
							R.drawable.ad_action_bar_gradient_bak));
			return true;
		default:
			return super.onOptionsItemSelected(item);
		}
	}

}
